Finding Reference-Counting Errors in Python/C Programs with Affine Analysis

نویسندگان

  • Siliang Li
  • Gang Tan
چکیده

Python is a popular programming language that uses reference counting to manage heap objects. Python also has a Foreign Function Interface (FFI) that allows Python extension modules to be written in native code such as C and C++. Native code, however, is outside Python’s system of memory management; therefore extension programmers are responsible for making sure these objects are reference counted correctly. This is an error prone process when code becomes complex. In this paper, we propose Pungi, a system that statically checks whether Python objects’ reference counts are adjusted correctly in Python/C interface code. Pungi transforms Python/C interface code into affine programs with respect to our proposed abstractions of reference counts. Our system performs static analysis on transformed affine programs and reports possible reference counting errors. Our prototype implementation found over 150 errors in a set of Python/C programs.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

pylibjit: A JIT Compiler Library for Python

We present pylibjit, a Python library for generating machine code at load time or run time. The library can be used for dynamic code generation, although it is mainly aimed at optimizing compilation of existing Python function definitions. Python functions can be compiled by simply annotating them with a decorator specifying data types. The pylibjit compiler takes advantage of this type informa...

متن کامل

Ownership You Can Count On

While many forms of memory management have been proposed, the only ones to achieve widespread adoption have been explicit deallocation and garbage collection. This leaves programmers requiring explicit control of memory behavior unable to obtain the software engineering and security benefits of programming in a safe language. We present a new approach to memory management called alias counting ...

متن کامل

Garbage Collection in JyNI - How to bridge Mark/Sweep and Reference Counting GC

Jython is a Java-based Python implementation and the most seamless way to integrate Python and Java. It achieves high efficiency by compiling Python code to Java bytecode and thus letting Java’s JIT optimize it – an approach that enables Python code to call Java functions or to subclass Java classes. It enables Python code to leverage Java’s multithreading features and utilizes Java’s built-in ...

متن کامل

Finding Errors in Python Programs Using Dynamic Symbolic Execution

For statically typed languages, dynamic symbolic execution (also called concolic testing) is a mature approach to automated test generation. However, extending it to dynamic languages presents several challenges. Complex semantics, fragmented and incomplete type information, and calls to foreign functions lacking precise models make symbolic execution difficult. We propose a symbolic execution ...

متن کامل

InRaDoS: An internal radiation dosimetry computer program

Introduction: Internal radiation dosimetry is important from a radiation protection point of view and can help to optimize the radiation dose delivered to the workers, public, and patients. It has a rather simple protocol but needs a large amount of data. Therefore, it is difficult to do on a routine basis. The use of computer programs makes internal radiation dosimetry simpler...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2014